import { ref } from 'vue'
import { defineStore } from 'pinia'
import { loginApi } from '@/apis/login'
export const useInfoStore = defineStore('userinfo', () => {
  const userInfo = ref({})
  const getUserInfo = async ({ account, password }) => {
   const res = await loginApi({ account, password })
    userInfo.value = res.data.result
   return res
  }

  const clearUserInfo = () => {
    userInfo.value = {}
  }
  return { userInfo, getUserInfo , clearUserInfo}
},{
  persist: true
})
